package poker;

/**
 * This class implements a playing card.
 *
 * @author Antti M. Harittu
 */
public class Card {

    /** Suit */
    private char s;
    
    /** Rank */
    private int r;

    /**
     * This method creates an object representing a playing card. The object has
     * s as a suit, r as a rank.
     * 
     * The variable s must be S, H, D or C and 1 < r < 15.
     * 
     * @param s
     * @param r 
     */
    public Card(char s, int r) { this.s = s; this.r = r; }
    
    /**
     * This method returns the playing card as a string, for example H14.
     * 
     * @return 
     */
    @Override
    public String toString() { return "" + this.s + this.r; }

    /**
     * This method works as toString() but the return value is visually
     * corrected, for example ♥A.
     * 
     * @return 
     */
    public String getPic() {
        String st = "";
        switch (this.s) {
            case 'S':
                st += "♠";
                break;
            case 'H':
                st += "♥";
                break;
            case 'D':
                st += "♦";
                break;
            case 'C':
                st += "♣";
                break;
        }
        switch (this.r) {
            case 14:
                st += "A";
                break;
            case 13:
                st += "K";
                break;
            case 12:
                st += "Q";
                break;
            case 11:
                st += "J";
                break;
            default:
                st += this.r;
        }
        return st;
    } // end getPic()

    /**
     * This method returns s.
     * 
     * @return 
     */
    public char getS() { return this.s; }
    
    /**
     * This method returns r.
     * 
     * @return 
     */
    public int getR() { return this.r; }
    
} // end class Card